<template>
  <common-search-wrap @search="search" @reset="searchReset">
    <el-form :rules="rules" ref="formRef" :inline="true" :model="formData">
      <el-form-item label="模块名称：" prop="mname">
        <el-input style="width: 200px" v-model="formData.mname" placeholder="请输入模块名称" clearable />
      </el-form-item>
      <el-form-item label="状态：" prop="state">
        <el-select v-model="formData.state" placeholder="可用状态">
          <el-option label="全部" value=""></el-option>
          <el-option label="可用" value="1"></el-option>
          <el-option label="禁用" value="0"></el-option>
        </el-select>
      </el-form-item>
    </el-form>
  </common-search-wrap>
</template>

<script setup>
import commonSearchWrap from "@/components/commonSearchWrap.vue";
import { reactive } from "vue";
import useForm from '@/hooks/useForm'
const emits = defineEmits(['submit'])
/** 搜索的方法 */
const handleSearch = () => {
  console.log('handleSearch: ', formData);
  emits('submit', formData)
}
const { formRef, search, reset } = useForm(handleSearch)
const formData = reactive({
  roleName: '',
  state: ''
});
const rules = {
  user: [
    { required: true, message: 'Please input Activity name', trigger: 'blur' },
  ],
  region: [
    {
      required: true,
      message: 'Please select Activity zone',
      trigger: 'change',
    },
  ],
}
const searchReset = () => {
  reset()
  handleSearch()
}
</script>